package io.renren.modules.generator.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.renren.modules.generator.entity.ResumeDataEntity;
import io.renren.modules.generator.service.ResumeDataService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 简历基本信息
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2020-04-28 09:08:38
 */
@RestController
@RequestMapping("generator/resumedata")
public class ResumeDataController {
    @Autowired
    private ResumeDataService resumeDataService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("generator:resumedata:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = resumeDataService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{resumeId}")
    @RequiresPermissions("generator:resumedata:info")
    public R info(@PathVariable("resumeId") Long resumeId){
		ResumeDataEntity resumeData = resumeDataService.getById(resumeId);

        return R.ok().put("resumeData", resumeData);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("generator:resumedata:save")
    public R save(@RequestBody ResumeDataEntity resumeData){
		resumeDataService.save(resumeData);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("generator:resumedata:update")
    public R update(@RequestBody ResumeDataEntity resumeData){
		resumeDataService.updateById(resumeData);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("generator:resumedata:delete")
    public R delete(@RequestBody Long[] resumeIds){
		resumeDataService.removeByIds(Arrays.asList(resumeIds));

        return R.ok();
    }

}
